home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 02 Useful Techniques / 03 Orkin / main.cpp < prev   
Encoding:
C/C++ Source or Header  |  2001-06-24  |  2.0 KB  |  47 lines

  1. #include "ActionTable.h"
  2.  
  3. void main()
  4. {
  5.     // Sample usage of the action table.
  6.  
  7.     CActionTable myActionTable;
  8.     myActionTable.Read();
  9.  
  10.     const char* szAnimFileName;
  11.  
  12.     // Play an idle animation for the default condition.
  13.     // The action table will randomly choose between the idle animations:
  14.     // "default_idle_scratchhead.anm", "default_idle_lookaround.anm", and "default_idle_flex".
  15.  
  16.     szAnimFileName = myActionTable.GetAnimation(kACond_Default, kAct_Idle, NULL);
  17.     szAnimFileName = myActionTable.GetAnimation(kACond_Default, kAct_Idle, NULL);
  18.     szAnimFileName = myActionTable.GetAnimation(kACond_Default, kAct_Idle, NULL);
  19.     szAnimFileName = myActionTable.GetAnimation(kACond_Default, kAct_Idle, NULL);
  20.  
  21.     // Play a run animation for the two-handed weapon condition.
  22.     // The action table will choose the only available animation:
  23.     // "two_handed_run.anm".
  24.  
  25.     szAnimFileName = myActionTable.GetAnimation(kACond_TwoHanded, kAct_Run, NULL);
  26.  
  27.     // Play an attack animation for the one-handed weapon condition.
  28.     // The action table will randomly choose between the attack animations:
  29.     // "one_handed_attack_swing.anm", and "one_handed_attack_jab".
  30.     // The action descriptor can be checked in code to determine which type
  31.     // of attack was chosen.
  32.  
  33.     EnumActionDescriptor eActDesc;
  34.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  35.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  36.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  37.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  38.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  39.     szAnimFileName = myActionTable.GetAnimation(kACond_OneHanded, kAct_Attack, &eActDesc);
  40.  
  41.     // Play a walk animation for the bow weapon condition.
  42.     // There are no bow animations, so the action table will choose the default walk animation:
  43.     // "default_walk.anm".
  44.  
  45.     szAnimFileName = myActionTable.GetAnimation(kACond_Bow, kAct_Walk, NULL);
  46. }
  47.